/**
 * 体验webpack打包过程
 */
//准备源代码
//准备webpack的打包环境npm i webpack webpack-cli --save-dev
//运行自定义命令  npm run build

import { checkphone, checkcode } from "../utils/check";

import "bootstrap/dist/css/bootstrap.min.css";
import "./login.css";

import "./login.less";

import myXios from "../utils/request";
import { myAlert } from "../utils/alert";

//图片地址会转成base64字符串
/* import imgobj from "./assets/logo.png";
const img = document.createElement("img");
img.src = imgobj;
document.querySelector(".login-wrap").appendChild(img); */

document.querySelector(".btn").addEventListener("click", () => {
  let phone = document.getElementsByName("mobile")[0].value;
  let code = document.getElementsByName("code")[0].value;
  if (!checkphone(phone)) {
    myAlert(false, "账号输入有误");
    return;
  }
  if (!checkcode(code)) {
    myAlert(false, "密码输入有误");
    return;
  }
  myAlert(true, "登录成功...");

  myXios({
    url:"",
    method:"post",
    data:{}
  }).then(result=>{}).catch(error=>{}) 
});